-
Notifications
You must be signed in to change notification settings - Fork 421
fix(docs): extract code snippets into dedicated python files and fix examples #1065
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #1065 +/- ##
========================================
Coverage 99.96% 99.96%
========================================
Files 119 119
Lines 5378 5378
Branches 613 613
========================================
Hits 5376 5376
Partials 2 2 Continue to review full report at Codecov.
|
I am just working through was was already there. And there is a lot to go through still. |
@ran-isenberg to be clear, i am just looking at all of the existing code examples in the docs (and per the roadmap issue) to be extracted as snippets. |
got it. Thanks for the quick reply. A misunderstanding on my part. |
Changes: - move examoples into "docs/" so that mkdoc automatically picks up changes - add a "format-examples" task to Makefile
Changes: - Extract examples - Fix missing import or initilization - Open external links in new browser tab
@heitorlessa this is read to review. I have deployed a sync up version of the docs on gyft.github.io/aws-lambda-powertools-python/latest. Just an initial review would be helpful to see if this meets the requirements of the papercuts #1009 |
I noticed in the docs we recommend using the Lambda layer, but that doesn’t work with code signing. Should we 1/ sign the layer so the signer could be shared or 2/ mention that code signing isn’t supported? |
True that is a gap in the documentation. And considering this is a best practice, we should call it out. |
I don't know how difficult it would be to sign the layer and share the signer in the same account that is hosting the layer, but I'd like to be able to use the layer with code signing myself. :) |
Hi @michaelbrewer, I appreciate your bias for action but this is unrealistic to review (66730K LOC changes), especially under our limited bandwidth. Could you please break this down into smaller PRs - one per utility - and discard Event Source Data Classes? Event Source Data Classes doc will be overhauled entirely. We will be looking into auto-generating that doc to better assist customers looking for a snippet as well as properties and methods. Thank you |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please break this down into smaller PRs - one per utility - and discard Event Source Data Classes changes?
Created an issue - could you please +1 so we can look into it the future? Lambda Layers is the biggest piece of work we're currently planning right now, and we would need to test whether a non-signed function can use a signed Lambda Layer |
|
@heitorlessa can you please remove the |
Changes: - Update make tasks to include shared code examples - Add missing dubug mode example - Correct python hl_lines spacing - Fix line highlights for validation and jmepath examples - Move schema.py into examples for Validation
@heitorlessa as per your request have created 16 smaller PRs which has the documentation examples extracted and fixes made to them Here is the list of PRs, to review them is the same really as this one.
|
Issue #, if available:
Description of changes:
Move code snippets into dedicated python files so they can be formatted (
isort
,black
), and then embedded in the docs.As part of the extraction a number of bugs was fixed, things like missing imports, python syntax errors, yaml formatting, invalid terraform and correct the line highlights.
A couple Makefile tasks where added to help verify changes (format-examples
make task to run
isortand
blackon examples and
lint-examplesmike task to run
python compileand
cfn-linton examples).
cfn-lint` may then become a dev dependency.Directory Structure: Currently examples are moved under
docs/examples
and relates to the directory and file names of the*.md
files: egdocs/core/logger.md
examples are indocs/examples/core/logger/
folder.Other things we can do: python syntax verification (black actually does a pretty good of checking for valid python) and cloudformation linting (cfn-lint) and sam validate.
Changes:
format-examples
make task to runisort
andblack
on exampleslint-examples
make task to runpython compile
andcfn-lint
on examplesdocs/index.md
examplesdocs/core/event_handler/appsync.md
examplesdocs/core/event_handler/api_gateway.md
examplesdocs/core/logger.md
examplesdocs/core/metrics.md
examplesdocs/core/tracer.md
examplesdocs/tutorial/index.md
examplesdocs/utilities/batch.md
examplesdocs/utilities/data_classes.md
examplesdocs/utilities/feature_flags.md
examplesdocs/utilities/idempotency.md
examplesdocs/utilities/jmespath_functions.md
examplesdocs/utilities/middleware_factory.md
examplesdocs/utilities/parser.md
examplesdocs/utilities/parameters.md
examplesdocs/utilities/typing.md
examplesdocs/utilities/validation.md
examplesDoc Fixes:
validator_function.py
example to match up, see Validation - Validate functionAWS Serverless Application Model (SAM) example
example for Rest api (and fixes Docs: Event Handler - Broken AWS Serverless Application Model (SAM) example #1069)Deserializing JSON before using as idempotency key
example in JMESPath - Missing importcustom_jmespath_function.py
example in JMESPath - Invalid python syntaxtemplate.yml
indentsAssert multiple EMF blobs with pytest
exampleCloning Logger config to all other registered standard loggers
which results in a errorAttributeError: module 'logging' has no attribute 'logger'
on line 8Accessing processed messages via context manager
example removing unused imports and fix line highlights.Extending failure handling mechanism in BatchProcessor
examplesuccess_handler
Batch - Creating a custom batch processor exampleCustomizing boto configuration
exampleCreating a S3 Provider to fetch parameters
exampleAWS Serverless Application Model (SAM) example
Exception not affecting idempotency record sample
exampleReusing a DynamoDB table that uses a composite primary key
exampleUsing Idempotency with JSONSchema Validation utility
exampleLambda Layer - SAM
exampleLambda Layer - Terraform
exampleSAR - SAM
exampleSAR - CDK
examplesExample: Least-privileged IAM permissions to deploy Layer
exampleEventBridge Envelope
exampleQuestions on the docs
During the conversion process some questions have some up for later review
logger_two
in this example for overriding log records will still includelocation
asLogger
can only be initialized once? A bug or confusing? (possible issue resolved by fix(logger-utils): ensure external loggers doesn't propagate logs on config copy #1075)Other docs to extract
Only Doc string are remaining, which is also part of the generated api reference and may be resolved by #517
Checklist
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.